//
//  SubController.m
//  gggggPro
//
//  Created by 顾宜林 on 2020/11/20.
//  Copyright © 2020 EDZ. All rights reserved.
//

#import "SubController.h"
#import <WebKit/WebKit.h>
#import "UIViewController+tool.h"
@interface SubController ()<WKNavigationDelegate,WKUIDelegate>
@property (nonatomic ,strong) WKWebView *webView;
@end

@implementation SubController
- (instancetype)initWith:(NSString *)url {
    self = [super init];
    if (self) {
        NSLog(@"回滚5");
    }
    return self;
}
- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
//    self.edgesForExtendedLayout = UIRectEdgeAll;
//    self.navigationController.navigationBar.translucent = YES;
    self.navigationController.navigationBar.backgroundColor = [UIColor yellowColor];
    UIImage *image = [UIViewController createAImageWithColor:[UIColor yellowColor] alpha:1];
    [self.navigationController.navigationBar setBackgroundImage:image forBarMetrics:UIBarMetricsDefault];
        
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.edgesForExtendedLayout = UIRectEdgeAll;
    
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    view.backgroundColor = [UIColor redColor];
    [self.view addSubview:view];

    [self.view addSubview:self.webView];
    
    UIEdgeInsets top = self.view.safeAreaInsets;
    NSLog(@"safe=%@",NSStringFromUIEdgeInsets(top));
    
//    NSURL *url = [NSURL URLWithString:@"https://www.baidu.com"];
//    NSURLRequest *request = [NSURLRequest requestWithURL:url];
//    [self.webView loadRequest:request];
//
//    [self firstMethod];
   
}

- (void)firstMethod {
    NSLog(@"我是自己的方法");
}

- (WKWebView *)webView {
    if (!_webView) {
        _webView = [[WKWebView alloc] initWithFrame:CGRectMake(100, 0, 200, 600)];
        _webView.navigationDelegate = self;
        _webView.UIDelegate = self;
        _webView.backgroundColor = [UIColor greenColor];
    }
    return _webView;
}


@end
